package com.tedu._04mybatis.mapper;

import com.tedu._04mybatis.pojo.Weibo;
import com.tedu._04mybatis.pojo.WeiboVO1;
import com.tedu._04mybatis.pojo.WeiboVO2;
import com.tedu._04mybatis.pojo.WeiboVO3;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
//    @Insert("insert into weibo(id,content,created,user_id) values(#{id},#{content},now(),#{userId})")
//    @Insert("insert into weibo(content,created,user_id) values(#{content},now(),#{userId})")
    int insert(Weibo weibo);
//    @Select("select id,content,created,user_id userId from weibo where id=#{id}")
    Weibo selectById(Integer id);
//    @Delete("delete from weibo where id=#{id}")
    int deleteById(Integer id);
    /*@Update("update weibo " +
            "set content=#{content},user_id=#{userId} " +
            "where id=#{id}")*/
    int updateById(Weibo weibo);
//    @Select("select id,content,created,user_id userId from weibo")
    List<Weibo> selectAll();
//    @Select("select content,created from weibo where id=#{id}")
    WeiboVO1 selectWeiboVO1ById(Integer id);
//    @Select("select content,user_id userId from weibo")
    List<WeiboVO2> selectAllWeibo2();
    int dynamicUpdate(Weibo weibo);
    //@Param("ids")
    int dynamicDeleteByIds(Integer[] ids);
    int dynamicDeleteByIds2(List<Integer> ids);
    WeiboVO3 selectWeiboVO3ById(Integer id);
    int countWeibo();
}
